﻿using Azure.Core;
using B.S.Passport.ErrorCode;
using B.S.Passport.Write.API.Application;
using B.S.Passport.Write.API.Application.PurchaseOrdername;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;


namespace B.S.Passport.Write.API.Controllers
{
        /// <summary>
        /// 111111111
        /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WHouaseController : ControllerBase
    {
        public readonly IMediator mediator;

        public WHouaseController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 库位添加
        /// </summary>
        /// <param name="addWhouse"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<object>> AddWhouse(AddWhouseCommand addWhouse)
        {
            return mediator.Send(addWhouse);
        }
        /// <summary>
        /// 库位删除
        /// </summary>
        /// <param name="delwhouse"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<ApiResult<object>> DelWhouse([FromQuery]DelwhouseCommand delwhouse)
        {
             return mediator.Send(delwhouse);
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<ApiResult<object>> DelsWhouse([FromQuery] DelsWhouseCommand delswhouse)
        {
            return mediator.Send(delswhouse);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="updateswhouse"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<ApiResult<object>> UPdateWhouse( UpdatewhouseCommand updateswhouse)
        {
            return mediator.Send(updateswhouse);
        }
        /// <summary>
        /// 采购添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<object>> PurchaseOrder(PurchaseOrderCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 采购添加
        /// <param name="addWhouse"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<object>> AddPurchaseOrder(PurchaseOrderCommand addWhouse)
        {
            return mediator.Send(addWhouse);
        }
    }
}
